package cc.rengu.igas.bomp.facade.enums;

/**
 * @author: zhangxuran
 * @Date: 2020/4/13 17:52
 * @Description: licenceType
 * 经营执照类型
 */
public enum BompSignLicenceTypeEnum {

    BUSINESS_LICENSE("00", "营业执照", "CERTIFICATE_TYPE_2389"),
    ORG_CREDIT_CODE_LICENSE("01", "机构信用代码证", ""),
    PRIVATE_NON_ENTERPRISE_REGIST_CERT("02", "民办非企业登记证书", "CERTIFICATE_TYPE_2395"),
    NATIONAL_ORG_CODE_CERT("03", "全国组织机构代码证)", "CERTIFICATE_TYPE_2393"),
    INSTITUTE_ARTIF_CERT("04", "事业单位法人证书", "CERTIFICATE_TYPE_2388"),
    OUT_ENTERPRISE_CERT("05", "境外企业证书", ""),
    SOCIAL_ORG_REGIST_CERT("06", "社会团体法人登记证书", "CERTIFICATE_TYPE_2394"),
    LEGAL_ARTIF_CERT("07", "工会法人资格证书", ""),
    GOVERMENT_DOCUMENT("08", "政府批文", ""),
    PRIOR_APPROVAL_NOTICE("09", "预先核准通知书", ""),
    OTHER_APPROVAL("10", "其他批文或证明", "CERTIFICATE_TYPE_2400"),
    LOANS_ACCTNO("11", "贷款卡号", ""),
    PAID_SERVICE_CERT("12", "有偿服务许可证(军队医院适用)", "CERTIFICATE_TYPE_2390"),
    MEDICAL_PRACTICE_LICENSE("13", "医疗执业许可证照(军队医院适用)", "CERTIFICATE_TYPE_2391"),
    PARTY_BUSINESS_LICENSE("14", "企业营业执照(挂靠企业的党组织适用)", "CERTIFICATE_TYPE_2392"),
    ARTIF_REG_CERT("15", "基金会法人登记证书", "CERTIFICATE_TYPE_2396"),
    CHARITABLE_ORGANIZATION_CERT("16", "慈善组织公开募捐资格证书", "CERTIFICATE_TYPE_2397"),
    AGRICULTURAL_COOPERATIVE_CERT("17", "农民专业合作社法人营业执照", "CERTIFICATE_TYPE_2398"),
    RELIGION_ORGANIZATION_CERT("18", "宗教活动场所登记证", "CERTIFICATE_TYPE_2399"),
    OTHER("99", "其他", ""),

    ;

    private String type;

    private String desc;

    private String wechatCertType;

    public String getType() {
        return type;
    }

    public String getDesc() {
        return desc;
    }

    public String getWechatCertType() {
        return wechatCertType;
    }

    BompSignLicenceTypeEnum(String type, String desc, String wechatCertType) {
        this.type = type;
        this.desc = desc;
        this.wechatCertType = wechatCertType;
    }

    public static boolean isWechatRealNameLicenceType(String licenceType) {
        if (null == licenceType || licenceType.isEmpty()) {
            return false;
        }
        for (BompSignLicenceTypeEnum bompSignLicenceTypeEnum : BompSignLicenceTypeEnum.values()) {
            if (bompSignLicenceTypeEnum.getType().equals(licenceType)) {
                return !(null == bompSignLicenceTypeEnum.getWechatCertType() || bompSignLicenceTypeEnum.getWechatCertType().isEmpty());
            }
        }
        return INSTITUTE_ARTIF_CERT.getType().equals(licenceType)
                || BUSINESS_LICENSE.getType().equals(licenceType)
                || PAID_SERVICE_CERT.getType().equals(licenceType)
                || MEDICAL_PRACTICE_LICENSE.getType().equals(licenceType)
                || PARTY_BUSINESS_LICENSE.getType().equals(licenceType)
                || NATIONAL_ORG_CODE_CERT.getType().equals(licenceType)
                || SOCIAL_ORG_REGIST_CERT.getType().equals(licenceType)
                || PRIVATE_NON_ENTERPRISE_REGIST_CERT.getType().equals(licenceType)
                || ARTIF_REG_CERT.getType().equals(licenceType)
                || CHARITABLE_ORGANIZATION_CERT.getType().equals(licenceType)
                || AGRICULTURAL_COOPERATIVE_CERT.getType().equals(licenceType)
                || RELIGION_ORGANIZATION_CERT.getType().equals(licenceType);
    }

    public static String getWechatCertTypeByLicenceType(String licenceType) {
        if (null == licenceType || licenceType.isEmpty()) {
            return null;
        }
        for (BompSignLicenceTypeEnum bompSignLicenceTypeEnum : BompSignLicenceTypeEnum.values()) {
            if (bompSignLicenceTypeEnum.getType().equals(licenceType)) {
                return bompSignLicenceTypeEnum.getWechatCertType();
            }
        }
        return null;
    }
}
